"""
字典合并
"""
dict1 = dict(eval(input()))
dict2 = dict(eval(input()))
for i in dict1:
    if i in dict2:
        dict1[i] += dict2.get(i)
dict3 = dict1.copy()
for i in dict2.keys():
    if i not in dict3:
        dict3.update({i: dict2[i]})
dict3 = dict(sorted(dict3.items(), key=lambda x: ord(x[0]) if type(x[0]) == str else x[0]))
result = str(dict3).replace(' ', '').replace("'", '"')
print(result)